extension StringExtension on String {
  List<String> splitWithCount(Pattern pattern, [int maxLength]) {
    List arr = this.split(pattern);
    if (maxLength != null && maxLength > 0 && maxLength < arr.length) {
      List<String> result = arr.sublist(0, maxLength - 1);
      result.add(arr.sublist(maxLength - 1).join());
      return result;
    }
    return arr;
  }
}
